package com.xg.util.excel;

import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;

public class UpdateTemplateStyleStrategy implements CellTemplateStyleStrategy {
    private final int columnIndex;
    private final int modifiedColumnIndex;

    public UpdateTemplateStyleStrategy(int columnIndex, int modifiedColumnIndex) {
        this.columnIndex = columnIndex;
        this.modifiedColumnIndex = modifiedColumnIndex;
    }

    @Override
    public void applyStyle(WriteCellStyle style) {
        if (columnIndex == modifiedColumnIndex) {
            style.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex());
        } else {
            style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
        }
    }
}

